﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace GrouponDesktop
{
    public partial class CambiarContraseña : Form
    {
        string login;


        public CambiarContraseña(string username)
        {
            InitializeComponent();
            login = username;

        }

        private void button1_Click(object sender, EventArgs e)
        {

            

            if (textBox1.Text != textBox1.Text)
            {

                error.Text = "Las contraseñas no coinciden.";

            }
            else
            {

                string query = "EXEC CodingSpree.UpdateContraseña ";
                string password = Funciones.ImprimirHash(textBox1.Text);
                query = query + "'" + login + "', " + "'" + password + "'";

                BDConnection.execute(query);

                MessageBox.Show("Contraseña actualizada con éxito.");

                Close();

            }


        }

        private void textBox2_TextChanged(object sender, EventArgs e)
        {

            button1.Enabled = true;

        }
    }
}
